package ${package.Service};

import ${package.Entity}.${entity};
import ${superServiceClassPackage};

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.file.system.entity.res.DataPage;

/**
* ${cfg.controllerName} 服务类
* @author ${author}
* @since ${date}
*/
<#if kotlin>
interface ${table.serviceName} : ${superServiceClass}<${entity}>
<#else>
public interface ${table.serviceName}{

    //添加${cfg.controllerName}
    boolean save(${entity} ${entity?uncap_first});
<#list table.fields as field>
<#if field_index == 0 && field.customMap.engine != "MRG_MYISAM">

    //添加${cfg.controllerName}(批量)
    boolean saveBatch(@Param("list") List<${entity}> ${entity?uncap_first}List);
</#if>
</#list>

    //添加或更新${cfg.controllerName}
    boolean saveOrUpdate(${entity} ${entity?uncap_first});

    //编辑${cfg.controllerName}
    boolean updateById(@Param("et")${entity} ${entity?uncap_first});

    //编辑
    boolean update(@Param("ew") UpdateWrapper<${entity}> query);

    //删除${cfg.controllerName}
    boolean removeById(@Param("id") Long id);

    //通过ids删除${cfg.controllerName}
    boolean removeByIds(List<Long> ids);

    //查询${cfg.controllerName}
    List<${entity}> list(@Param("ew") QueryWrapper<${entity}> query);

    //通过ids查询${cfg.controllerName}集合
    List<${entity}> listByIds(List<Long> ids);

    //查询所有非删除状态${cfg.controllerName}
    List<${entity}> listAll();

    //查询${cfg.controllerName}分页
    DataPage<List<${entity}>> page(@Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize, @Param("ew") QueryWrapper<${entity}> query);

    //通过id查询${cfg.controllerName}
    ${entity} getById(@Param("id") Long id);

    //通过条件查询${cfg.controllerName}
    ${entity} getByOne(@Param("ew") QueryWrapper<${entity}> query);

    //查询${cfg.controllerName}数量
    int count(@Param("ew") QueryWrapper<${entity}> query);
}
</#if>
